#include <iostream>
#include <string>
using namespace std;

class MyStack;

class listNode
{
    friend class MyStack;
    friend class LinkQueue;

private:
    listNode *next;
    int data;

public:
    listNode();
    listNode(int nodeData, listNode *succ = NULL);
};

class MyStack
{
private:
    listNode *topNode;
    int stackSize;

public:
    MyStack();
    ~MyStack();

    bool push(const int &);
    bool pop(int &);
    bool getTop(int &);
    void printStack();
};

class MyQueue
{
private:
    int *queue;
    int capacity;
    int front;
    int rear;

public:
    MyQueue(const int &);
    ~MyQueue();

    bool enQueue(const int &);
    bool deQueue(int &);
    bool getFront(int &);
    void printQueue();

    bool isFull();
    bool isEmpty();
};

class LinkQueue
{
private:
    int queueSize;
    listNode *first;
    listNode *rear;

public:
    LinkQueue();

    bool enQueue(const int &);
    int deQueue();
};

bool postfixExpression(const string &, string &);

bool expressionVal(const string &, int &);

void yanghui(const int &);

char Precede(char, char); // 算符比较算法
